package com.ljq.software_springboot.softwareprogram.controller;


import com.ljq.software_springboot.softwareprogram.entity.ChatMember;
import com.ljq.software_springboot.softwareprogram.entity.GroupMessage;
import com.ljq.software_springboot.softwareprogram.imp.GroupMessageServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author author
 * @since 2024-12-29
 */
@RestController
@RequestMapping("/group-message")
@CrossOrigin(origins = "http://localhost:5173")
public class GroupMessageController {
    @Autowired
    GroupMessageServiceImpl groupMessageService;
    @PostMapping("findmessage")
    public List<GroupMessage> findmessager(@RequestBody GroupMessage groupMessage){
        return  groupMessageService.findmessage(groupMessage.getGroupId());
    }
    @PostMapping("/send")
    public Boolean sendMessage(@RequestBody GroupMessage messageRequest) {
        return groupMessageService.saveMessage(messageRequest);
    }
}
